import { createRouter, createWebHashHistory, RouteRecordRaw } from "vue-router"

export const asyncRoutes: RouteRecordRaw[] = [
    {
        path: '/',
        redirect: '/login'
    },
    { 
        path: '/login',
        name: 'login',
        meta: {
            title: '登录',
        },
        component: () => import('@/views/login.vue')
    },
    { 
        path: '/index',
        name: 'index',
        meta: {
            title: '首页',
        },
        component: () => import('@/layout/layout.vue'),
        children: [
            {
                name: '首页',
                path: '/home',
                component: () => import('@/views/home.vue'),
            },
            {
                name: '测试任务',
                path: '/task',
                component: () => import('@/views/task.vue'),
            },
            {
                name: '模块测试',
                path: '/moduleTest',
                component: () => import('@/views/moduleTest.vue'),
            }
        ]
        
    },
]

const router = createRouter({
    history: createWebHashHistory(),
    routes: asyncRoutes,
    scrollBehavior: () => ({ left: 0, top: 0})
})

export default router